<!DOCTYPE html>
<html lang="en">
<head>
    <!--
    @Author 硕鼠
    @Date 2020/4/18 19:55
    @Version 1.0
    @Description 文件说明
  -->
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-3.4.1.min.js"></script>
    <script>
        $(function () {
           let list = [{ //定义一个对象
               id:"01", //统一使用双引号
               name:"张三",
               age:18,
               sex:"男"
           },{
               id:"02",
               name:"李四",
               age:20,
               sex:"男"
           }];
           for (let i = 0;i < list.length;i ++){
               let user = list[i];
               document.write(user.id + "\t"+user.name +"\t" + user.age +"\t"+user.sex +"<br/>")
           }

           //json字符串和对象
           let jsonStr = '{"name":"Liza","password":"123"}';
           let jsonObject = {"name":"Liza","password":"123"};
           console.log(jsonStr);
           console.log(jsonObject);

           //json字符串转化为json对象
            console.log($.parseJSON(jsonStr));

            //json对象转化为json字符串
            console.log(JSON.stringify(jsonObject));


        });
    </script>
</head>
<body>
</body>
</html>